package com.ruoyi.system.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TCarouselMapper;
import com.ruoyi.system.domain.TCarousel;
import com.ruoyi.system.service.ITCarouselService;
import com.ruoyi.common.core.text.Convert;

/**
 * APP轮播图Service业务层处理
 *
 * @author zhaohs
 * @date 2020-12-30
 */
@Service
public class TCarouselServiceImpl implements ITCarouselService {
    @Autowired
    private TCarouselMapper tCarouselMapper;

    /**
     * 查询APP轮播图
     *
     * @param id APP轮播图ID
     * @return APP轮播图
     */
    @Override
    public TCarousel selectTCarouselById(Long id) {
        return tCarouselMapper.selectTCarouselById(id);
    }

    /**
     * 查询APP轮播图列表
     *
     * @param tCarousel APP轮播图
     * @return APP轮播图
     */
    @Override
    public List<TCarousel> selectTCarouselList(TCarousel tCarousel) {
        return tCarouselMapper.selectTCarouselList(tCarousel);
    }

    @Override
    public List<TCarousel> selectEnableTCarouselList() {
        TCarousel tCarousel = new TCarousel();
        tCarousel.setStatus(1);
        List lst = tCarouselMapper.selectTCarouselList(tCarousel);
        if (lst == null){
            return  new ArrayList<TCarousel>();
        }
        return lst;
    }

    /**
     * 新增APP轮播图
     *
     * @param tCarousel APP轮播图
     * @return 结果
     */
    @Override
    public int insertTCarousel(TCarousel tCarousel) {
        return tCarouselMapper.insertTCarousel(tCarousel);
    }

    /**
     * 修改APP轮播图
     *
     * @param tCarousel APP轮播图
     * @return 结果
     */
    @Override
    public int updateTCarousel(TCarousel tCarousel) {
        return tCarouselMapper.updateTCarousel(tCarousel);
    }

    /**
     * 删除APP轮播图对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTCarouselByIds(String ids) {
        return tCarouselMapper.deleteTCarouselByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除APP轮播图信息
     *
     * @param id APP轮播图ID
     * @return 结果
     */
    @Override
    public int deleteTCarouselById(Long id) {
        return tCarouselMapper.deleteTCarouselById(id);
    }
}
